﻿using System.Collections.Generic;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
namespace SCPAK2
{
    public class SimpleTextAdapter : BaseAdapter
    {

        public List<string> Vs = new List<string>();
        private Context context;
        public SimpleTextAdapter(Context _)
        {
            context = _;
        }

        public void Add(string msg)
        {
            Vs.Add(msg);

        }
        public override Java.Lang.Object GetItem(int position)
        {
            return Vs[position];
        }

        public override long GetItemId(int position)
        {
            return position;
        }

        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            var inflater = context.GetSystemService(Context.LayoutInflaterService).JavaCast<LayoutInflater>();
            convertView = inflater.Inflate(Resource.Layout.textlist_item, parent, false);
            convertView.FindViewById<TextView>(Resource.Id.itemName).Text = Vs[position];
            return convertView;
        }

        public override int Count
        {
            get
            {
                return Vs.Count;
            }
        }

    }
}